package com.chaosj.memory;

import com.chaosj.lexicon.ParseSogo;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @className: ParserSogouLexIcon
 * @description:
 * @author: caoyangjie
 * @date: 2021/8/13
 **/
public class ParserSogouLexIcon {
    public static void main(String[] args) {
        try {
            String fileName = "/home/caoyangjie/IdeaProjects/spring-stack-skills/skill-memory/src/main/resources/lexicon/c";
//            String fileName = ClassLoader.getSystemClassLoader().getResource("lexicon/c").getPath();
            Files.list(Paths.get(ClassLoader.getSystemResource("sogou").toURI())).forEach(path->{
                String fName = path.toFile().getName();
                if( fName.endsWith(".scel") ){
                    ParseSogo.sogou(path.toString(), String.format("%s/THUOCL_%s", fileName, fName.replace(".scel",".txt")), true);
                }
            });
        } catch (URISyntaxException e) {
        } catch (IOException e) {
        }
    }
}
